
import java.util.Scanner;

class ATM {
    public static void main(String[] args) {

        System.out.println("================家庭收支记账================");
        System.out.println("1.收支细明");
        System.out.println("2.收入");
        System.out.println("3.支出");
        System.out.println("4.退出");
        System.out.println("输入1-4");

        Scanner shuru = new Scanner(System.in);//键盘输入

        double yue = 0;

        while(true){

            int a = shuru.nextInt();
            System.out.println("选择————>"+a);
            if (a == 2) {
                System.out.println("本次收入为");
                double qian = shuru.nextInt();
                yue = yue + qian;
                System.out.println("收入说明为");
                char shuoming1 = shuru.nextInt();
            }else if (a == 3) {
                System.out.println("本次支出金额为");
                double quqian = shuru.nextInt();
                yue= yue - quqian;
                 System.out.println("支出说明为");
                 char shuoming2 = shuru.nextInt();
                }

            }else if (a == 1) {
                System.out.println("支收      支收余额      说明");  
                System.out.println("收入"+yue+"元"+shuoming1);
                System.out.println("你还有"+yue+"元");    
            }else if (a == 4) {
                System.out.println("你退出程序了");
                break;
            }
        }
    }
}
